package com.aiyige.trace.model;

public class Trace {
    String target;
    String traceId;
    int code;
    boolean transientTrace;

    public Trace() {
    }

    private Trace(Builder builder) {
        setTarget(builder.target);
        setTraceId(builder.traceId);
        setCode(builder.code);
        setTransientTrace(builder.transientTrace);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isTransientTrace() {
        return transientTrace;
    }

    public void setTransientTrace(boolean transientTrace) {
        this.transientTrace = transientTrace;
    }

    public static final class Builder {
        private String target;
        private String traceId;
        private int code;
        private boolean transientTrace;

        private Builder() {
            target = "";
            traceId = "";
            code = 0;
            transientTrace = false;
        }

        public Builder target(String val) {
            target = val;
            return this;
        }

        public Builder traceId(String val) {
            traceId = val;
            return this;
        }

        public Builder code(int val) {
            code = val;
            return this;
        }

        public Builder transientTrace(boolean val) {
            transientTrace = val;
            return this;
        }

        public Trace build() {
            return new Trace(this);
        }
    }
}
